<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>simpledb - Amazon SimpleDB command line interface</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#options">OPTIONS</a></li>
	<li><a href="#arguments">ARGUMENTS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#examples">EXAMPLES</a></li>
	<li><a href="#environment">ENVIRONMENT</a></li>
	<li><a href="#files">FILES</a></li>
	<li><a href="#installation">INSTALLATION</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#caveats">CAVEATS</a></li>
	<li><a href="#history">HISTORY</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>simpledb - Amazon SimpleDB command line interface</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
 simpledb [opts] create-domain DOMAIN
 simpledb [opts] delete-domain DOMAIN
 simpledb [opts] list-domains</pre>
<pre>
 simpledb [opts] put         DOMAIN ITEM [NAME=VALUE]...
 simpledb [opts] put-replace DOMAIN ITEM [NAME=VALUE]...
 simpledb [opts] get         DOMAIN ITEM [NAME]...
 simpledb [opts] delete      DOMAIN ITEM [NAME[=VALUE]]...</pre>
<pre>
 simpledb [opts] select SELECTEXPRESSION</pre>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<pre>
 --help         Print help and exit.</pre>
<pre>
 --aws-access-key-id KEY
                AWS access key id
                [Defaults to $AWS_ACCESS_KEY_ID environment variable]</pre>
<pre>
 --aws-secret-access-key SECRETKEY
                AWS secret access key
                [Defaults to $AWS_SECRET_ACCESS_KEY environment variable]</pre>
<pre>
 --max COUNT
                Maximum number of domains/items to retrieve and list.
                [Defaults to all]</pre>
<pre>
 --separator STRING
                Separator between attribute name and value.
                [Defaults to equals (=)]</pre>
<p>
</p>
<hr />
<h1><a name="arguments">ARGUMENTS</a></h1>
<pre>
 DOMAIN            Domain name
 ITEM              Item name
 NAME              Attribute name
 VALUE             Attribute value
 SELECTEXPRESSION  SimpleDB select expression</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This utility provides a simple command line interface to most Amazon
SimpleDB (SDB) actions.</p>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p># The following examples assume you have set these environment variables:</p>
<pre>
  export AWS_ACCESS_KEY_ID=...
  export AWS_SECRET_ACCESS_KEY=...</pre>
<p># Create a new SimpleDB domain:</p>
<pre>
  simpledb create-domain mydomain</pre>
<p># List the domains for this account:</p>
<pre>
  simpledb list-domains</pre>
<p># Create some items with attribute name=value pairs:</p>
<pre>
  simpledb put mydomain item1 key1=valueA key2=value2 x=why</pre>
<pre>
  simpledb put mydomain item2 key1=valueB key2=value2 y=zee</pre>
<p># Add another value for an attribute on an item:</p>
<pre>
  simpledb put mydomain item2 y=zed when=now who=you</pre>
<p># Replace all values for specific attributes on an item:</p>
<pre>
  simpledb put-replace mydomain item1 key1=value1 newkey=newvalue</pre>
<p># Delete all values for specific attributes on an item:</p>
<pre>
  simpledb delete mydomain item1 x</pre>
<p># Delete specific values for specific attributes on an item:</p>
<pre>
  simpledb delete mydomain item2 who=you</pre>
<p># List all item names in a domain</p>
<pre>
  simpledb select 'select itemName() from mydomain'</pre>
<p># List all items and their attributes matching a given select query:</p>
<pre>
  simpledb select 'select * from mydomain where key2=&quot;value2&quot;'</pre>
<p># List all attributes on an item:</p>
<pre>
  simpledb get mydomain item1</pre>
<pre>
  simpledb get mydomain item2</pre>
<p># List specific attributes on an item:</p>
<pre>
  simpledb get mydomain item2 key2 y</pre>
<p># Delete the entire SimpleDB domain including all items and attributes:</p>
<pre>
  simpledb delete-domain mydomain</pre>
<p>
</p>
<hr />
<h1><a name="environment">ENVIRONMENT</a></h1>
<pre>
 AWS_ACCESS_KEY_ID
                Default AWS access key id</pre>
<pre>
 AWS_SECRET_ACCESS_KEY
                Default AWS secret access key</pre>
<p>
</p>
<hr />
<h1><a name="files">FILES</a></h1>
<pre>
 $HOME/.awssecret
                If the above fail, then the keys are sought here in the
                format expected by the &quot;aws&quot; toolkit (one per line):
                        access_key_id
                        secret_access_key</pre>
<pre>
 /etc/passwd-s3fs
                If all of the above fail, then the keys are sought
                here in the format expected by s3fs (colon separated):
                        access_key_id:secret_access_key</pre>
<p>
</p>
<hr />
<h1><a name="installation">INSTALLATION</a></h1>
<p>BEWARE! The installation of dependencies is somewhat messy with this
release and may require some understanding of how Perl works!</p>
<p>This tool depends on the following Perl modules from CPAN:</p>
<pre>
  Getopt::Long
  Pod::Usage
  Digest::SHA1
  Digest::HMAC
  XML::Simple</pre>
<p>You can install them using the &quot;cpan&quot; command on many Linux distros:</p>
<pre>
  sudo cpan Getopt::Long Pod::Usage Digest::SHA1 Digest::HMAC XML::Simple</pre>
<p>This tool also depends on the Amazon::SDB modules provided by Amazon
(not the one in CPAN).  Amazon's modules can be found here:</p>
<pre>
  <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1136">http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1136</a></pre>
<p>Here is how I installed them.</p>
<pre>
  curl -Lo amazon-simpledb-perl-library.zip \
    <a href="http://amazon-simpledb-perl-library.notlong.com">http://amazon-simpledb-perl-library.notlong.com</a></pre>
<pre>
  unzip amazon-simpledb-perl-library.zip</pre>
<pre>
  sitelib=$(perl -MConfig -le 'print $Config{sitelib}')
  sudo scp -r amazon-simpledb-*-perl-library/src/Amazon $sitelib</pre>
<p>Finally, this command line interface can be installed with:</p>
<pre>
  sudo curl -Lo /usr/local/bin/simpledb <a href="http://simpledb-cli.notlong.com">http://simpledb-cli.notlong.com</a>
  sudo chmod +x /usr/local/bin/simpledb</pre>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p>Latest versions of this script available from the Google Code project:
<a href="http://code.google.com/p/amazon-simpledb-cli/">http://code.google.com/p/amazon-simpledb-cli/</a></p>
<p>Amazon SimpleDB (SDB)
<a href="http://www.amazon.com/SimpleDB-AWS-Service-Pricing/b/?node=342335011">http://www.amazon.com/SimpleDB-AWS-Service-Pricing/b/?node=342335011</a></p>
<p>Amazon SimpleDB Developer Guide
<a href="http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/">http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/</a></p>
<p>sdbShell (another SimpleDB command line interface by David Kavanagh)
<a href="http://code.google.com/p/typica/">http://code.google.com/p/typica/</a></p>
<p>
</p>
<hr />
<h1><a name="caveats">CAVEATS</a></h1>
<p>As currently written this tool does not support keys containing equal
signs (=).</p>
<p>Output will be difficult to parse if the values contain newlines.</p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<pre>
 2010-04-20 Eric Hammond &lt;ehammond@thinksome.com&gt;
 - Removed support for &quot;query&quot;.  Please migrate to &quot;select&quot;</pre>
<pre>
 2009-09-01 Peter Kaminski &lt;kaminski@istori.com&gt;
 - Added utf8 binmode for STDOUT
 - Added select method</pre>
<pre>
 2009-03-16 Eric Hammond &lt;ehammond@thinksome.com&gt;
 - Fix --max options and large result sets without --max
   <a href="http://code.google.com/p/amazon-simpledb-cli/issues/detail?id=2">http://code.google.com/p/amazon-simpledb-cli/issues/detail?id=2</a></pre>
<pre>
 2008-06-09 Eric Hammond &lt;ehammond@thinksome.com&gt;
 - Fallback to finding keys in $HOME/.awssecret or /etc/passwd-s3fs</pre>
<pre>
 2008-06-03 Eric Hammond &lt;ehammond@thinksome.com&gt;
 - Completed --max option
 - bugfix: Corrected --aws-secret-access-key option spelling</pre>
<pre>
 2008-05-26 Eric Hammond &lt;ehammond@thinksome.com&gt;
 - Original release</pre>

</body>

</html>
